Skip to content

feat: sync api_key plugin runtime and sql with management ui changes#3

Open
yzbf-lin wants to merge 2 commits intofastapi-practices:masterfrom
yzbf-lin:feature/api-key-plugin-sync
Open

feat: sync api_key plugin runtime and sql with management ui changes#3
yzbf-lin wants to merge 2 commits intofastapi-practices:masterfrom
yzbf-lin:feature/api-key-plugin-sync

Conversation

@yzbf-lin
Copy link

Summary

This PR syncs the standalone api_key plugin with the current API Key management UI contract.

It aligns the plugin runtime APIs, write payload schema, masked list output, and adds the plugin-level MySQL menu SQL used for host integration.

Changes

  • Fix paginated list API by adding pagination dependency and paged response type
  • Add PUT /api/v1/sys/api-keys/{pk}/status for quick enable/disable
  • Pass is_superuser through the delete API path
  • Fix masked key handling for paginated list items
  • Replace expire_days with expire_time in create/update schema
  • Update CRUD write semantics to persist expire_time directly
  • Add sql/mysql/api_key_menu.sql at plugin root level

Affected Files

  • api/v1/sys/api_key.py
  • schema/api_key.py
  • service/api_key_service.py
  • crud/crud_api_key.py
  • sql/mysql/api_key_menu.sql

Validation

  • python3 -m py_compile api/v1/sys/api_key.py schema/api_key.py service/api_key_service.py crud/crud_api_key.py

Compatibility Notes

This PR changes the create/update request contract from expire_days to expire_time.

Clients still sending expire_days need to be updated accordingly.

Related

linwu@onemt.com.cn added 2 commits March 17, 2026 13:12
Align the standalone api_key plugin with the current API Key management UI contract.\n\nThis updates pagination, status toggling, expire_time write semantics, masked list output, and adds the MySQL menu SQL alongside the plugin runtime code.
Replace the single MySQL menu script with the standard plugin SQL layout.\n\nThis adds MySQL/PostgreSQL init scripts for both normal and snowflake ID modes and keeps the menu definitions aligned across dialects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sync api_key plugin with management UI contract

1 participant